<?php

/**
 * PendingTeacher form.
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class PendingTeacherForm extends BasePendingTeacherForm {

    public function configure() {

        unset(
                $this['intg_identity2']
                , $this['sub_id']
                , $this['q_id']
                , $this['nat_id']
                , $this['job_id']
                , $this['created_by_user_id']
                , $this['updated_by_user_id']
                , $this['emp_status']
                , $this['q_date']
                , $this['is_hanged']
                , $this['hange_status']
                , $this['birth_date']
                , $this['program_list']
                , $this['pre_school']
                , $this['is_manager']
                , $this['is_trainer']
                , $this['university']
                , $this['special_id']
        );
        
        
        $this->widgetSchema['school_intg_id'] = new sfWidgetFormInputHidden();
        $this->widgetSchema['intg_identity'] = new sfWidgetFormInput();
        $this->validatorSchema['intg_identity'] = new sfValidatorNumber(array('required' => true));
        
        $this->validatorSchema['f_name'] = new sfValidatorString(array('required' => true));
        $this->validatorSchema['s_name'] = new sfValidatorString(array('required' => true));
        $this->validatorSchema['t_name'] = new sfValidatorString(array('required' => true));
        $this->validatorSchema['l_name'] = new sfValidatorString(array('required' => true));

        $this->validatorSchema['work_date'] = new sfValidatorString(array('required' => false));
        
        $this->validatorSchema->setPostValidator(
                new sfValidatorAnd(array(
                    new sfValidatorDoctrineUnique(array('required' => true, 'model' => 'PendingTeacher', 'column' => 'intg_identity', 'object' => $this->getObject()))
                ))
        );
        $year = date('Y');
        $years = range($year - 591, $year - 571); // 
        $this->widgetSchema['work_date'] = new sfWidgetFormDate(
                        array(
                            'format' => '%month%/%day%/%year%'
                            , 'years' => $years
                        )
        );

        $this->setCustomFormatter(); // to display form with stars
    }

}
